import request from '@/utils/request'

// 查询节目列表
export function programs(query) {
  return request({
    url: '/lgsvapi/program/list',
    method: 'get',
	params: query
  })
}

// 新增节目
export function addProgram(data) {
  return request({
    url: '/lgsvapi/program/add',
    method: 'post',
    data: data
  })
}

// 删除节目
export function delprogram(data) {
  return request({
    url: '/lgsvapi/program/remove',
    method: 'delete',
	data:data
	
  })
}

// 获取节目参数
export function programsParm() {
  return request({
    url: '/lgsvapi/config/list',
    method: 'get'
  })
}

// 图片上传
export function programsImg(params,id,cofi,fWidth,fHeight) {
	let [ file ] = params
	let fd = new FormData()
	fd.append('file', file)
	return request({
    url: '/lgsvapi/file/upload?&deptId='+id+'&fIsMaterial='+cofi+'&fWidth='+fWidth+'&fHeight='+fHeight,
    method: 'post',
	data:fd
  })
}
// 节目号
export function programsNo(id) {
	return request({
     url: '/lgsvapi/program/programNumList?deptId='+id,
     method: 'get'
  })
}
// 修改节目
export function editProgram(data) {
  return request({
    url: '/lgsvapi/program/edit',
    method: 'put',
    data: data
  })
}
// 获取设备宽高
export function getCard(id) {
  return request({
    url: '/lgsvapi/config/cardGroupConfig/'+id,
    method: 'get',
  })
}
// 修改节目删除图片接口
export function delImg(data) {
  return request({
    url: '/lgsvapi/file/remove',
    method: 'delete',
		data:data
  })
}
// 获取设备
export function getDev(query) {
  return request({
    url: '/lgsvapi/card/treeselect',
    method: 'get',
	params: query
  })
}

// 节目发送
export function programsSend(data) {
  return request({
    url: '/lgsvapi/program/send',
    method: 'post',
    data: data
  })
}

// 节目下架
export function pullProgram(data) {
  return request({
    url: 'lgsvapi/program/sendPNoRemove',
    method: 'post',
    data: data
  })
}

// 查询素材列表
export function getMaterial(query) {
  return request({
    url: 'lgsvapi/file/list',
    method: 'get',
	params: query
  })
}

// 删除素材
export function delMaterial(data) {
  return request({
    url: '/lgsvapi/file/removes',
    method: 'delete',
	  data:data
	
  })
}
// 修改素材
export function editMaterial(params,fFileId,deptId,fIsMaterial,fWidth,fHeight) {
	let [ file ] = params
	let fd = new FormData()
	fd.append('file', file)
  return request({
    url: '/lgsvapi/file/edit?fFileId='+fFileId+'&deptId='+deptId+'&fIsMaterial='+fIsMaterial+'&fWidth='+fWidth+'&fHeight='+fHeight,
    method: 'post',
    data: fd
  })
}

// 以下是设备模板数据接口
// 设备操作
export function cardSend (data) {
  return request({
    url: 'lgsvapi/card/send',
    method: 'post',
    data: data
  })
}

// 查询扫描数据
export function scanModeList() {
  return request({
    url: '/lgsvapi/config/scanModeList',
    method: 'get'
  })
}
